kind: pipeline
type: docker
name: default

steps:
- name: build
  image: klakegg/hugo:alpine-ci
  commands:
  # Submodules are not handled by Drone, even doesn't appear on git config --list.
  # So needs to be manually added.
  - apk add --no-cache git
  # To avoid error '...already exists and is not a valid git repo'
  - git rm -r src/themes/ananke
  - git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git src/themes/ananke
  - cd src
  - test -e config.toml && hugo
  - cd ..

- name: push commit
  image: appleboy/drone-git-push
  settings:
    branch: main
    remote: git@codeberg.org:hugo-test/pages.git
    force: false
    commit: true
    commit_message: "Drone build ${DRONE_COMMIT_SHA:0:7}"
    author_name: "John Doe"
    author_email: "example@email.com"
    ssh_key:
      from_secret: ssh_key
